﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Diagnostics;   
namespace  Valhalla.Emulator
{
    class Clock
    {
        CPU myX80;
        //Stopwatch sw;
        Double frq = 1.0 / (4.19 * 10000);
        public Clock(CPU mx80)
        {
            myX80 = mx80;
            
            //sw = new Stopwatch();
        }

        public void RunCPU()
        {
            while(true)
            {
                do
                {
                    myX80.doStep();
                }
                while(myX80.tick < 100);
                myX80.tick = 0;
                Thread.Sleep(System.TimeSpan.FromSeconds(frq));
            }

        }


    }
}
